// 商家码模版model
class MerchantCodeModel {

  MerchantCodeModel({
    this.id,
    this.industryName,
    this.material,
    this.spec,
    this.image,
    this.count,
    this.buyCount,
    this.price,
    this.templateSpecList,
    this.templateList,
  });
  
  final int? id;// 模版id
  String? industryName;// 行业名称
  final String? material;// 材质
  final String? spec;// 规格
  final String? image;// 模板图片
  final double? price;// 价格
  final int? count;// 数量
  int? buyCount;// 购买数量数量
  final List<MerchantCodeModel>? templateSpecList;// 规格模版列表
  final List<MerchantCodeModel>? templateList;// 规格列表


  factory MerchantCodeModel.fromJson(Map<String, dynamic> json){
    return MerchantCodeModel(
      id: json["id"],
      industryName: json["industryName"]??'',
      material: json["material"]??'亚克力板带自粘胶',
      spec: json["spec"]??'0x0',
      image: json["image"]??'',
      count: json["count"]??0,
      buyCount: json["buyCount"]??0,
      price: json["price"]??0.0,
      // templateSpecList: (json['templateSpecList']??[]).map((e) => MerchantCodeModel.fromJson(e)).toList(),
      templateSpecList: (json['templateSpecList'] as List<dynamic>?)
          ?.map((e) => MerchantCodeModel.fromJson(e))
          .toList() ?? [],
      templateList: (json['templateList'] as List<dynamic>?)
          ?.map((e) => MerchantCodeModel.fromJson(e))
          .toList() ?? [],
    );
  }

  Map<String, dynamic> toJson() => {
    "id": id,
    "industryName": industryName,
    "material": material,
    "spec": spec,
    "image": image,
    "count": count,
    "buyCount": buyCount,
    "price": price,
    'templateSpecList': templateSpecList?.map((e) => e.toJson()).toList(),
    'templateList': templateList?.map((e) => e.toJson()).toList(),
  };
}
